import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router);

import Layout from '@/layout'


// 公共路由
export const constantRoutes = [
    // {
    //     path: '/redirect',
    //     component: Layout,
    //     hidden: true,
    //     children: [
    //         {
    //             path: '/redirect/:path(.*)',
    //             component: () => import('@/views/redirect')
    //         }
    //     ]
    // },
    // {
    //     path: '/404',
    //     component: () => import('@/views/error/404'),
    //     hidden: true
    // },
    // {
    //     path: '/401',
    //     component: () => import('@/views/error/401'),
    //     hidden: true
    // },
    {
        path:'/',
        redirect: '/home'

    },
    {
        path: '/home',
        component: Layout,
        children: [
            {
                path: '',
                component: () => import('@/views/index'),
                name: 'Index',
                meta: { title: '首页', icon: 'dashboard', affix: true }
            },
            {
                path: 'wechat-member-manager',
                component: () => import('@/views/WechatMemberManager'),
                name: 'wechat-member-manager',
                meta: { title: '微信用户管理', icon: 'dashboard', affix: true }
            }
        ]
    }/*,
    {
        path: '/user',
        component: Layout,
        hidden: true,
        redirect: 'noredirect',
        children: [
            {
                path: 'profile',
                component: () => import('@/views/system/user/profile/index'),
                name: 'Profile',
                meta: { title: '个人中心', icon: 'user' }
            }
        ]
    }*/
]
const router = new Router({
    mode: 'history', // 去掉url中的#
    scrollBehavior: () => ({y: 0}),
    routes: constantRoutes
})
router.beforeEach((to, from, next) => {
    window.document.title = to.meta.title
    console.log(to);
    next()
});
export default router




